package com.leaf.lowcode.sdk.door_controller;

import com.alibaba.fastjson.JSON;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.leaf.lowcode.entity.door_control.StatesRequest;

import java.util.HashMap;
import java.util.Map;

public class ArtemisPostTest_queryDoorStates {
    /**
     * STEP1：设置平台参数，根据实际情况,设置host appkey appsecret 三个参数.
     */
    static {
        ArtemisConfig.host = "ip:port";// 平台门户/nginx的IP和端口（必须使用https协议，https端口默认为443）
        ArtemisConfig.appKey = "请填入appKey"; // 秘钥appkey
        ArtemisConfig.appSecret = "请填入appSecret";// 秘钥appSecret
    }
    /**
     * STEP2：设置OpenAPI接口的上下文
     */
    private static final String ARTEMIS_PATH = "/artemis";

    //查询门禁点状态
    public static String states(StatesRequest statesRequest ){
        String statesDataApi = ARTEMIS_PATH +"/api/acs/v1/door/states";
        Map<String,String> path = new HashMap<String,String>(2){
            {
                put("https://",statesDataApi);
            }
        };
        String body= JSON.toJSONString(statesRequest);
        String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json");
        return result;
    }
}
